<include file="/public/header" />
<style>
    .layui-table-cell {
        overflow: visible;
        text-overflow: inherit;
        white-space: normal;
        height: auto;
        /*在这里设置行高没用*/
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="status">
                                <option value="">{:__('上架状态查询')}</option>
                                <option value="2">{:__('已上架')}</option>
                                <option value="1">{:__('未上架')}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="type">
                                <option value="">{:__('兑换类型查询')}</option>
                                <option value="2">{:__('门店兑换')}</option>
                                <option value="1">{:__('快递发货')}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="ishot">
                                <option value="">{:__('是否推荐')}</option>
                                <option value="2">{:__('是')}</option>
                                <option value="1">{:__('否')}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="title" class="layui-input" type="text" placeholder="{:__('关键字搜索')}" />
                        </div>
                    </div>

                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i
                                class="layui-icon layui-icon-search"></i>{:__('搜索')}</button>
                        <!-- // 打开添加页面 -->
                        <button data-area="762px,95%" class="layui-btn icon-btn" lay-open=""
                            data-title="{:__('添加')}{:__('产品')}" data-url="{:url('/system/Pointproduct/add')}"
                            callback="add" lay-event="add">
                            <i class="layui-icon layui-icon-add-1"></i>{:__('添加')}
                        </button>
                        <div class="layui-divider layui-divider-vertical"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" data-title="{:__('编辑')} {{d.title}}" 
        data-area="762px,95%" data-url="{:url('/system/Pointproduct/edit')}?id={{d.id}}"  lay-event="edit" >{:__('编辑')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" data-url="{:url('/system/Pointproduct/del')}?id={{d.id}}" lay-event="del">{:__('删除')}</a>
</script>

<!-- // 列表状态栏 -->
<script type="text/html" id="columnType">
    {{#  if(d.type ==1){ }}
    快递发货
    {{# }if(d.type ==2) { }}
    门店兑换
    {{#  } }}
</script>
<script type="text/html" id="columnHot">
    {{#  if(d.ishot ==1){ }}
    正常
    {{# }if(d.ishot ==2) { }}
    推荐
    {{#  } }}
</script>
<script type="text/html" id="columnStatus">
    {{#  if(d.status ==1){ }}
    待上架
    {{# }if(d.status ==2) { }}
    已上架
    {{#  } }}
</script>
<include file="/public/footer" />
<script>
    layui.use(['admin', 'layedit', 'table', 'form', 'content'], function () {
        var admin = layui.admin;
        var table = layui.table;
        var form = layui.form;
        var layedit = layui.layedit;
        var content = layui.content;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url('/system/Pointproduct/index')}"
            , page: true
            , limit: 18
            , cols: [[
                { type: 'checkbox', width: 50 },
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                { field: 'title', align: 'left', title: '{:__("产品名称")}' },
                {
                    field: 'images', align: 'center', width: 100, templet: function (d) {
                        return d.images[0] ? '<div><img src="' + d.images[0] + '" width="50" height="50" lay-image-hover="" ></div>' : '<div></div>';
                    }, title: '图片'
                },
                { field: 'type', align: 'center', templet: '#columnType', title: '{:__("兑换类型")}' },
                { field: 'type', align: 'center', templet: '#columnHot', title: '{:__("推荐")}' },
                { field: 'type', align: 'center', templet: '#columnStatus', title: '{:__("上架状态")}' },
                { field: 'price', align: 'left', title: '{:__("原价")}' },


                { field: 'integral', align: 'left', title: '{:__("需要积分")}' },
                { field: 'redeemed', align: 'left', title: '{:__("已兑换数量")}' },
                { field: 'create_time', align: 'center', width: 180, title: '{:__("添加时间")}' },
                { align: 'center', toolbar: '#tableBar', width: 160, title: '{:__("操作")}' },
            ]],
            done: function () {
                //当数据渲染完后，执行的回调
            }
        })
    })
</script>